<div style="width: 100%;padding:5px 5px 5px 5px;background-color:#afba9b;color:white;">
	<strong>Venue Management</strong>
</div>
<script type="text/javascript">
	var oUploadWin
	var oImgForm;
	$(document).ready(function(){
		oUploadWin = $("#uploadWin");
		oUploadWin.dialog({
			autoOpen:false,
			close: function(event,ui){$("#newImage").val("");}
					});
		oImgForm = $("#venueImageForm").ajaxForm({
						url: "index.php?dosoap=&editVenue=&uploadVenuePic",	
						dataType: 'json',
						success:function(data){
							resultMsg("Image file has been successfully uploaded.","success");
						},
						error:function(data){		
							debugger;
							resultMsg("Image file upload failed.\n" + data.responseText,"error");
						}
					});
	});
	function openUploadWin(){
		oUploadWin.dialog("open");
	}
	function uploadPic(){
		oImgForm.submit();	
	}
	function resultMsg(text,cssClass){
		alert(text);
	}
</script>

<?php printf("<a href=\"?%s\">&lt; Back to the list</a>",AdminItemEnum::COURSES);?>
<fieldset>
	<legend>Venue:</legend>
	<?php
	if($venue->hasphoto && isset($venue->photo->photoId)){
		?><a href="#" onclick="openUploadWin()" style="float:right;">Add photo</a><br/><?php
		printf("<img src=\"?display=&photo_id=%s&size=m\"/>",$venue->photo->photoId);
	}
	else{
		?><p><strong>No image available.</strong><br/><a href="#" onclick="openUploadWin()">Add photo</a></p><?php
	}
									
	?>
	
<?php printf("<form action=\"index.php?%s=&editVenue&venueid=%s\" method=\"post\">",AdminItemEnum::COURSES,$venue->venueid); ?>
	Name: <input type="text" name="txtBxVenueName" value="<?php echo $venue->venuename;?>"/><br/>
	Address 1: <input type="text" name="txtBxAddress1" value="<?php echo $venue->streetaddress1;?>"/><br/>
	Address 2: <input type="text" name="txtBxAddress2" value="<?php echo $venue->streetaddress2;?>"/><br/>
	City: <input type="text" name="txtBxCity" value="<?php echo $venue->city;?>"/> State: <input type="text" name="txtBxStateCode" value="<?php echo $venue->statecode;?>" maxlength="2" size="2" /><br/>
	Zipcode: <input type="text" name="txtBxZipcode" value="<?php echo $venue->zipcode;?>"/><br/>
	Phone: <input type="text" name="txtByPhone" value="<?php echo $venue->phone;?>"/><br/>
	URL: <input type="text" name="txtBxURL" value="<?php echo $venue->webaddress;?>"/><br/>
	Email: <input type="text" name="txtEmailAddress" value="<?php echo $venue->emailaddress;?>"/><br/>
	<input type="button" value="Cancel" onclick="history.go(-1)"/><input type="submit" name="btnSaveVenue" value="Save"/>
</form>
</fieldset>
<div id="uploadWin" style="display:none">
	<div id="divImgForm">
		<form id="venueImageForm" method="post" enctype="multipart/form-data">
			<input type="file"  name="newImage" id="newImage" />
			<input type="button" value="Upload" onclick="uploadPic();"/>
			<input type="hidden" name="hdnVenueId" value="<?php echo $venue->venueid?>"/>
		</form>
	</div>
	<div id="divUploadResult" style="display:none;"></div>
</div>